package com.zryc.shop.cms.controller;

import com.zryc.shop.base.Result;
import com.zryc.shop.cms.service.ISubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 专题表 前端控制器
 * </p>
 *
 * @author zhaozhao
 * @since 2024-01-18
 */
@RestController
@Api(tags = "专题管理")
@RequestMapping("/cms/subject")
public class SubjectController {

    @Autowired
    private ISubjectService subjectService;

    @GetMapping("/listAll")
    @ApiOperation("查询全部subject")
    public Result listAll(){
        return Result.ok(subjectService.list());
    }

    @GetMapping("/list")
    @ApiOperation("分页查询专题列表")
    public Result list(@RequestParam(defaultValue = "1") Integer pageNum,
                               @RequestParam(defaultValue = "5") Integer pageSize,
                               @RequestParam(required = false) String keyword){
        return Result.ok(subjectService.list(pageNum, pageSize,keyword));
    }

}
